import { request } from '@/utils';
import { getRestBaseUrl } from '@/config';

// 查询商品列表
export const listAuditGoodsApi = (form, page = { pageSize: 100, pageNum: 1 }) =>
  request({
    url: `${getRestBaseUrl()}/iop/adjustService/listAuditGoods`,
    method: 'POST',
    data: { form, page },
    timeout: 3 * 60 * 1000,
  });

// 查询商品是否限购
export const listLimit = (channelCode = null, goodsCodes = null) =>
  request({
    url: `${getRestBaseUrl()}/iop/taskService/listLimit`,
    method: 'POST',
    data: { channelCode, goodsCodes },
    timeout: 3 * 60 * 1000,
  });

// 批量调价审核商品查询
export const listBatchTaskGoodsApi = form =>
  request({
    url: `${getRestBaseUrl()}/iop/adjustService/listBatchTaskGoods`,
    method: 'POST',
    data: { form },
    timeout: 3 * 60 * 1000,
  });

// 导出
export const exportGoodsPriceApi = form =>
  request({
    url: `${getRestBaseUrl()}/iop/ExportTaskService/exportGoodsPrice`,
    method: 'POST',
    data: { form },
    timeout: 3 * 60 * 1000,
  });

// 更新审核商品
export const updateAuditGoodsApi = auditGoods =>
  request({
    url: `${getRestBaseUrl()}/iop/adjustService/updateAuditGoods`,
    method: 'POST',
    data: { auditGoods },
    timeout: 3 * 60 * 1000,
  });

// 商品列表 - 全部审核
export const auditByQueryFormApi = form =>
  request({
    url: `${getRestBaseUrl()}/iop/adjustService/auditByQueryForm`,
    method: 'POST',
    data: { form },
    timeout: 3 * 60 * 1000,
  });

// 商品列表 - 批量审核
export const auditByAuditGoodsIdsApi = auditGoodsIds =>
  request({
    url: `${getRestBaseUrl()}/iop/adjustService/auditByAuditGoodsIds`,
    method: 'POST',
    data: { auditGoodsIds },
    timeout: 3 * 60 * 1000,
  });
